home *** CD-ROM | disk | FTP | other *** search
- * INVOICES.CMD
- * This file accepts inputs for invoices to clients. Individual projects
- * and items are stored in the Billings data file. Any number of items
- * may be entered using a single invoice number. Invoice numbers are
- * automatically generated by the computer and stored in the Constant.Mem
- * file.
- * After all the job billings have been entered, they are summarized by
- * invoice number and the data is stored in the Invoices file.
- * A printout of items billed and invoice totals is provided.
-
-
-
- RESTORE FROM Constant
- SET TALK OFF
- DO GetDate
-
- USE Billings
- COPY STRUCTURE TO GetCosts
-
- USE GetCosts
- STORE ' ' TO Billing
- DO WHILE !(Billing) <> 'F'
- APPEND BLANK
- STORE STR(#,5) TO Number
- REPLACE Inv:Date WITH Date, Inv:Nmbr WITH Next:Inv
-
- ERASE
- STORE 'T' TO Entering
- DO WHILE !(Entering) <> 'F'
- ERASE
- @ 3, 0 SAY 'INVOICE NUMBER '+Next:Inv
- @ 3,30 SAY ' DATE '+Inv:Date
- @ 5,0 SAY ' RECORD NUMBER: '-Number
- IF !(Billing) = 'S'
- @ 7,0 SAY ' CLIENT:'+MClient
- REPLACE Client WITH MClient
- ELSE
- @ 7,0 SAY ' CLIENT ' GET Client
- ENDIF
-
- @ 8,0 SAY ' JOB NUMBER ' GET Job:Nmbr
- @ 9,0 SAY 'TAXABLE AMOUNT ' GET Taxable
- @ 10,0 SAY 'TAXFREE AMOUNT ' GET TaxFree
- @ 11,0 SAY ' P. O. NUMBER ' GET PO:Nmbr
- @ 12,0 SAY ' DESCRIPTION ' GET Descrip
- READ
-
- STORE !(Client) TO MClient
- REPLACE Client WITH !(MClient),Descrip WITH !(Descrip),;
- PO:Nmbr WITH !(PO:Nmbr)
- @ 7,16 SAY Client
- @ 11,16 SAY PO:Nmbr
- @ 12,16 SAY Descrip
- IF Taxable > 0
- REPLACE Sales:Tax WITH 0.06*Taxable
- @ 13,0 SAY ' SALES TAX' GET Sales:Tax
- ENDIF
-
- IF Job:Nmbr < 100
- @ 16,0 SAY ' JOB not 3 digits.'
- ENDIF
-
- IF MClient <> ' ' .AND. (Taxable > 0 .OR. TaxFree > 0)
- @ 17,0 SAY ' C to CHANGE this entry.'
- ? ' <Return> to continue.'
-
- WAIT TO New
- IF !(New)='C'
- STORE 'T' TO Entering
- ELSE
- @ 16,0 SAY ' F if FINISHED, '
- @ 17,0 SAY ' S for SAME invoice number,'
- @ 18,0 SAY ' <Return> for NEXT invoice number.'
- @ 19,0 SAY ' '
- ACCEPT TO New
-
- IF !(New) <> 'S'
- STORE STR(VAL(Next:Inv)+3,5) TO Next:Inv
- ENDIF
- STORE 'F' TO Entering
- ENDIF
- STORE New TO Billing
- ELSE
- @ 17,0 SAY ' CLIENT or AMOUNT missing.'
- ?
- ? ' F if FINISHED,'
- ? ' <Return> to correct the record.'
- WAIT TO Billing
- IF !(Billing)='F'
- DELETE RECORD &Number
- STORE 'F' TO Entering
- ELSE
- STORE 'T' TO Entering
- ENDIF
- ENDIF
- ENDDO Entering
- ENDDO Billing
-
- RELEASE Billing, Entering, MClient, Task, Number, Date, New
- SAVE TO Constant
-
- PACK
-
-
- GO TOP
- ERASE
- IF EOF
- ? 'No invoices to add to the file.'
- ? 'Press any key to continue.'
- WAIT
- ELSE
- @ 5,20 SAY '**** DO NOT INTERRUPT ****'
- @ 7,20 SAY 'UPDATING BILLINGS AND INVOICES'
-
- * Costs entered are totalled by invoice number to Scratch because several
- * job costs can be entered against each invoice number.Amounts are adjusted
- * for one client who always pays promptly and takes a 2% discount. Each
- * invoice is totalled. Temp has only summary data needed for a printout.
-
-
- USE Invoices
- COPY STRUCTURE TO Scratch
-
- USE GetCosts
- ERASE
- @ 5,10 SAY 'When ready to print the billings you just added,'
- @ 6,10 SAY 'press <Return>'
- TOTAL ON Inv:Nmbr TO Scratch FIELDS Taxable, Sales:Tax, TaxFree
- WAIT TO Number
-
- SET PRINT ON
- ? 'ENTRIES BY JOB NUMBER:'
- ?
- ? 'INV # JOB DATE TAXABLE TAX TAXFREE P.O.# DESCRIPTION'
- ?
-
- * "Output" is needed in the Printout Command file
- STORE 'Y' TO Output
- STORE 'OFF' TO Condition
- DO Printout
-
- * One of our clients always pays promptly and takes a 2% discount.
- * We do this after the original entries were printed out:
- REPLACE Taxable WITH 0.980*Taxable,TaxFree WITH 0.980*TaxFree,Sales:Tax;
- WITH 0.980*Sales:Tax FOR Client = 'SPI'
- ?
- ? 'Updating the BILLINGS database now.'
- USE Billings INDEX Billings
- APPEND FROM GetCosts
-
- USE Scratch
- REPLACE All Amount WITH (Taxable + Sales:Tax + TaxFree)
- COPY TO Temp FIELDS Inv:Date,Inv:Nmbr, Taxable, Sales:Tax,;
- TaxFree, Amount
- REPLACE Taxable WITH 0.980*Taxable, TaxFree WITH 0.980*TaxFree, Sales:Tax;
- WITH 0.980*Sales:Tax,Amount WITH 0.980*Amount FOR Client = 'SPI'
-
- USE Temp
- STORE 'Y' TO Output
- SET PRINT ON
- ?
- ?
- ? 'TOTALS BY INVOICE NUMBER:'
- ?
- ? 'DATE INV# TAXABLE TAX TAXFREE TOTAL'
- ?
-
- DO Printout
- ?
- ? 'Updating the INVOICES database now.'
- USE Invoices INDEX Invoices
- APPEND FROM Scratch
- ENDIF
-
- USE
- DELETE FILE Scratch
- DELETE FILE Temp
- DELETE FILE GetCosts
- RELEASE All
- RETURN